home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / ada / adaed-1.11 / adaed-1 / Adaed-1.11.0a / ipredef.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-02-07  |  4.3 KB  |  158 lines

  1. /*
  2.  * Copyright (C) 1985-1992  New York University
  3.  * 
  4.  * This file is part of the Ada/Ed-C system.  See the Ada/Ed README file for
  5.  * warranty (none) and distribution info and also the GNU General Public
  6.  * License for more details.
  7.  
  8.  */
  9. /*    +---------------------------------------------------+
  10.       |                           |
  11.       |      I N T E R P     P R E D E F S          |
  12.       |                           |
  13.       |          D E F I N I T I O N S          |
  14.       |                           |
  15.       |           (C Version)              |
  16.       |                           |
  17.       |   Adapted From Low Level SETL version written by  |
  18.       |                           |
  19.       |          Monte Zweben              |
  20.       |           Philippe Kruchten           |
  21.       |           Jean-Pierre Rosen           |
  22.       |                           |
  23.       |    Original High Level SETL version written by      |
  24.       |                           |
  25.       |           Clint Goss              |
  26.       |           Tracey M. Siesser           |
  27.       |           Bernard D. Banner           |
  28.       |           Stephen C. Bryant           |
  29.       |          Gerry Fisher              |
  30.       |                           |
  31.       |          C version written by          |
  32.       |                           |
  33.       |           Robert B. K. Dewar          |
  34.       |                           |
  35.       +---------------------------------------------------+
  36. */
  37.  
  38.  
  39. /* Constants For PRDEF Operations */
  40.  
  41. #include <stdlib.h>
  42. #include <stdio.h>
  43. #include "config.h"
  44. #include "int.h"
  45. #include "predef.h"
  46. #include "ivars.h"
  47.  
  48. /* ASCII control characters */
  49.  
  50. #define  BS   0x08
  51. #define  HT   0x09
  52. #define  LF   0x0a
  53. #define  FF   0x0c
  54. #define  CR   0x0d
  55.  
  56. /* ASCII quote character */
  57.  
  58. #define QUOTE 0x27
  59.  
  60. /* Codes used in io_mode field of AFCB */
  61.  
  62. #define SIO_IN_FILE    0    /* SEQUENTIAL_IO IN  */
  63. #define SIO_OUT_FILE   1    /* SEQUENTIAL_IO OUT */
  64.  
  65. #define DIO_IN_FILE    0    /* DIRECT_IO IN    */
  66. #define DIO_INOUT_FILE 1    /* DIRECT_IO INOUT */
  67. #define DIO_OUT_FILE   2    /* DIRECT_IO OUT   */
  68.  
  69. #define TIO_IN_FILE    0    /* TEXT_IO IN  */
  70. #define TIO_OUT_FILE   1    /* TEXT_IO OUT */
  71.  
  72. /* Utility macros to access attributes of current file */
  73.  
  74. #define IOFDESC        (afcbs[filenum-1]->io_fdesc)
  75. #ifdef IO_EOF
  76. #define IOEOF            afcbs[filenum-1]->io_eof
  77. #endif
  78. #define IOFNAME        (afcbs[filenum-1]->io_fname)
  79. #define IOFORM           (afcbs[filenum-1]->io_form)
  80. #define IOMODE           (afcbs[filenum-1]->io_mode)
  81. #define DPOS           (afcbs[filenum-1]->dio_pos)
  82. #define DSIZE           (afcbs[filenum-1]->dio_size)
  83. #define DLENGTH        (afcbs[filenum-1]->dio_length)
  84. #define PAGE           (afcbs[filenum-1]->tio_page)
  85. #define LINE           (afcbs[filenum-1]->tio_line)
  86. #define COL           (afcbs[filenum-1]->tio_col)
  87. #define LINE_LENGTH       (afcbs[filenum-1]->tio_line_length)
  88. #define PAGE_LENGTH       (afcbs[filenum-1]->tio_page_length)
  89. #define CHARS           (afcbs[filenum-1]->tio_count)
  90. #define CHAR1           (afcbs[filenum-1]->tio_look_ahead[0])
  91. #define CHAR2           (afcbs[filenum-1]->tio_look_ahead[1])
  92. #define CHAR3           (afcbs[filenum-1]->tio_look_ahead[2])
  93.  
  94. /* Macros testing file attributes */
  95.  
  96. #define BOUNDED_LINE_LENGTH    (LINE_LENGTH > 0)
  97. #define UNBOUNDED_LINE_LENGTH  (LINE_LENGTH == 0)
  98. #define BOUNDED_PAGE_LENGTH    (PAGE_LENGTH > 0)
  99. #define UNBOUNDED_PAGE_LENGTH  (PAGE_LENGTH == 0)
  100. #define PAGE_TERMINATED (COL == 1 && LINE == 1 && PAGE != 1)
  101.  
  102. /* Maximum identifier length */
  103.  
  104. #define  MAX_ID        80
  105.  
  106. /* Define special characters in text file */
  107.  
  108. #define PAGE_MARK  0x0C            /* page terminator */
  109. #define LINE_FEED  0x0a            /* line terminator */
  110.  
  111. /* Convert character to upper case */
  112.  
  113. #define UPPER_CASE(x) (('a' <= (x) && (x) <= 'z') ? (x - 32) : x)
  114.  
  115. /* Forward definitions for value returning functions */
  116.  
  117. int scan_integer();
  118. int scan_integer_string();
  119. long scan_fixed();
  120. long scan_fixed_string();
  121. float scan_float();
  122. float scan_float_string();
  123. int get_argument_value();
  124. float get_float_argument_value();
  125. long get_long_argument_value();
  126. int *get_argument_ptr();
  127.  
  128. char get_char();
  129. char *make_string();
  130. char *predef_alloc();
  131.  
  132. /* On the PC, need to distinguish binary and text files, so use
  133.  * fopen_bin and fopen_txt, respectively. On other machines, this
  134.  * distinction need not be made, so fopen_bin and fopen_txt are
  135.  * macros.
  136.  */
  137. #ifdef IBM_PC
  138. FILE *fopen_bin();
  139. FILE *fopen_txt();
  140. #else
  141. #define fopen_bin(a,b) fopen(a,b)
  142. #define fopen_txt(a,b) fopen(a,b)
  143. #endif
  144.  
  145. #define COUNT_LAST 32767
  146. #define LOWER_CASE 0
  147.  
  148. #define DISCARD_GENERIC_PARAMETER cur_stackptr -= 2
  149.  
  150. /* if DEBUG_PREDEF defined, get detailed trace on IO operations
  151.  * using pchar and gchar; these are made into null macros if
  152.  * the trace is not desired.
  153.  */
  154. #ifndef DEBUG_PREDEF
  155. #define pchar(a,b)
  156. #define gchar(a,b)
  157. #endif
  158.